public class ThreadInterrupt {
    public static void main(String[] args) throws InterruptedException {
        Foodie f = new Foodie();
        f.start();
        for(int i = 0; i < 5; i++){
            Thread.sleep(1000);
            System.out.println("hello world~");
        }
        f.interrupt();
    }
}

class Foodie extends Thread{
    int count = 0;

    @Override
    public void run(){

        while(true){
            for(int i = 0; i < 100; i++){
                System.out.println("大胖子吃了 "+(count++)+"个大肉包子！");
            }
            System.out.println("大胖子休息中");
            try {
                sleep(20*1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

